---
layout: "default"
title: "unsafeBitCast"
description: "Swift documentation for 'unsafeBitCast': Returns the the bits of x, interpreted as having type U."
keywords: "unsafeBitCast,func,swift,documentation"
root: "/v2.1"
---

<div class="declaration" id="func-unsafebitcast-t-u_-t_-u-type">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-unsafebitcast-t-u_-t_-u-type">func unsafeBitCast&lt;T, U&gt;(<wbr>_:<wbr> T, _: U.Type)</a>
        
<div class="comment collapse" id="comment-func-unsafebitcast-t-u_-t_-u-type"><div class="p">
    <p>Returns the the bits of <code>x</code>, interpreted as having type <code>U</code>.</p>

<p><strong>Warning:</strong> Breaks the guarantees of Swift&#39;s type system; use
  with extreme care.  There&#39;s almost always a better way to do
  anything.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func unsafeBitCast&lt;T, U&gt;(x: T, _: U.Type) -&gt; U</code>
    
    
</div></div>
</div>
